import { dialog, ipcMain, OpenDialogOptions } from 'electron';

async function handleFileOpen(event, options) {
  const { canceled, filePaths } = await dialog.showOpenDialog(options);
  if (canceled) {
    event.returnValue = null;
    return;
  }
  event.returnValue = filePaths;
}

ipcMain.on('file-open', handleFileOpen);
